

//
//  MineViewController.m
//  广告页
//
//  Created by YYY on 2017/2/20.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

#import "MineViewController.h"

#import "NewViewController.h"

#import "BaseNavigationController.h"

#import "AppDelegate.h"

@interface MineViewController () <UITableViewDataSource,UITableViewDelegate>
{
    UITableView *tempTableView;
}
@end

@implementation MineViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    UIImageView *bgImage = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    bgImage.image = [UIImage imageNamed:@"image4.jpg"];
    bgImage.userInteractionEnabled = YES;
    self.view = bgImage;

    //初始化表视图
    [self initTableView];
    // Do any additional setup after loading the view.
}

-(void)initTableView
{
    tempTableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain];
    tempTableView.dataSource = self;
    tempTableView.delegate = self;
    tempTableView.tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 180)];
    tempTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:tempTableView];
    tempTableView.backgroundColor = [UIColor clearColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark UITableView delegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identify = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify];
    if (!cell)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify];
        cell.textLabel.font = [UIFont systemFontOfSize:15];
        cell.textLabel.textColor = [UIColor redColor];
        cell.backgroundColor = [UIColor clearColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.textLabel.text = [NSString stringWithFormat:@"所在行：%ld",indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NewViewController *newVC = [[NewViewController alloc]init];

    [appDelegate.LeftSlideVC closeLeftView];
    
    BaseNavigationController *navNewVC = appDelegate.root.selectedViewController;
    [navNewVC pushViewController:newVC animated:YES];
    //[rootVC.navVC pushViewController:newVC animated:YES];
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
